<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>产品信息管理</title>
<meta name="decorator" content="default" />
<script
	src="/jeesite/static/jquery-validation/1.11.1/localization/messages_zh.js"></script>
	<script src="/jeesite/pro/realDetailForm/js/choiceProInfo.js"
	type="text/javascript"></script>
	<script src="/jeesite/pro/realDetailForm/js/choiceProductType.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(
			function() {
				//$("#name").focus();
				$("#inputForm")
						.validate(
								{
									submitHandler : function(form) {
										loading('正在提交，请稍等...');
										form.submit();
									},
									errorContainer : "#messageBox",
									errorPlacement : function(error, element) {
										$("#messageBox").text("输入有误，请先更正。");
										if (element.is(":checkbox")
												|| element.is(":radio")
												|| element.parent().is(
														".input-append")) {
											error.appendTo(element.parent()
													.parent());
										} else {
											error.insertAfter(element);
										}
									}
								});
			});
	//清空产品类型编号
	 function empty(){
	   $("#productTypeCodeNum").val("");
   }
</script>
</head>
<body class="fixed-top">
	<div class="container" style="width: 100%;">
		<div style="margin: 20px; border: 1px solid #c8d1d5;">
			<div
				style="padding: 13px; background-color: #f4f4f4; border-bottom: 1px solid #c8d1d5;">
				<h4>
					<i class="icon-globe"></i>产品${not empty productInfo.id?'修改':'添加'}
				</h4>
			</div>
			<div style="margin: 17px;">
				<form:form id="inputForm" modelAttribute="productInfo"
					action="${ctx}/pro/productInfo/save" method="post"
					class="form-horizontal">
					<form:hidden path="id" />
					<sys:message content="${message}" />
					<div class="control-group">
						<label class="control-label">产品编号：</label>
						<div class="controls">
							<form:input path="codeNum" readonly="true" placeholder="自动生成，可不填" />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">产品名称：</label>
						<div class="controls">
							<form:input path="name" htmlEscape="false" maxlength="64"
								class="input-xlarge required" />
							<span class="help-inline"><font color="red">*</font></span>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">产品代码：</label>
						<div class="controls">
							<form:input path="productCode" htmlEscape="false" maxlength="64"
								class="input-xlarge required" />
							<span class="help-inline"><font color="red">*</font></span>
						</div>
					</div>
					<div class="control-group" style="display: none;">
						<label class="control-label">产品类型编号：</label>
						<div class="controls">
							<form:input path="productTypeCodeNum" htmlEscape="false" maxlength="64"
								class="input-xlarge required" id="productTypeCodeNum"/>
							<span class="help-inline"><font color="red">*</font></span>
						</div>
					</div>
						<div class="control-group">
						<label class="control-label">产品类型：</label>
						<div class="controls">
							<form:input path="productTypeName" htmlEscape="false" id="productTypeName"
								maxlength="64" placeholder="输入信息或双击选择" onchange="empty()"/>
						</div>
					</div>
				<div class="control-group">
						<label class="control-label">计量单位：</label>
						<div class="controls">
							<form:select path="unitCodeNum" class="input-medium"
								items="${fns:getUnitList()}" style="width: 220px;"
								itemLabel="name" itemValue="codeNum" htmlEscape="false">
							</form:select>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">品牌：</label>
						<div class="controls">
							<form:input path="brand" htmlEscape="false" maxlength="64"
								class="input-xlarge " />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">封装：</label>
						<div class="controls">
							<form:input path="packaging" htmlEscape="false" maxlength="64"
								class="input-xlarge " />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">规格：</label>
						<div class="controls">
							<form:input path="specifications" htmlEscape="false"
								maxlength="64" class="input-xlarge required" />
							<span class="help-inline"><font color="red">*</font></span>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">是否预警：</label>
						<div class="controls">
							<form:radiobutton path="warning" value="1" />
							是
							<form:radiobutton path="warning" value="0" checked="${empty productInfo.id?'true':''}"/>
							否
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">预警上限：</label>
						<div class="controls">
							<form:input path="upperLimit" htmlEscape="false" maxlength="64"
							onkeyup="value=value.replace(/[^\d.]/g,'')" class="input-xlarge " />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">预警下限：</label>
						<div class="controls">
							<form:input path="LowerLimit" htmlEscape="false" maxlength="64"
							onkeyup="value=value.replace(/[^\d.]/g,'')" class="input-xlarge " />
						</div>
					</div>

					<div class="control-group">
						<label class="control-label">备注信息：</label>
						<div class="controls">
							<form:textarea path="remarks" htmlEscape="false" rows="4"
								maxlength="255" class="input-xxlarge " />
						</div>
					</div>
					<div class="form-actions">
						<shiro:hasPermission name="pro:productInfo:edit">
							<input id="btnSubmit" class="btn btn-primary" type="submit"
								value="保 存" />&nbsp;</shiro:hasPermission>
						<input id="btnCancel" class="btn" type="button" value="返 回"
							onclick="history.go(-1)" />
					</div>
				</form:form>
			</div>
		</div>
	</div>
	<!-- 	产品类型jBox -->
	<div id="divProductType" class="hide">
		<div style="padding: 10px;">
			<div>
				<form:form class="breadcrumb form-search">
					<ul class="ul-form">
						<li><label style="width: 100px">产品类型：</label> 
						<input type="text" id="" style="width: 100px;" /> 
						<a  class="btn btn-primary" href="javascript:void(0)" onclick="selectProductType(this)"> 
						<i class="icon-search"></i>&nbsp;搜索 </a>
					</ul>
				</form:form>
			</div>
			<table
				class="table tablesorter table-striped table-bordered table-condensed"
				style="margin-top: 10px;">
				<thead>
					<tr>
						<th style="width: 8px;"></th>
						<th>产品类型编号</th>
						<th>名称</th>
						<th>备注</th>
					</tr>
				</thead>
				<tbody id="rowProductType"></tbody>
			</table>
			<div class="pagination">
				<ul>
					<li id="productTypePreviousPageLi" class="disabled"><a
						id="productTypePreviousPage" href="javascript:">&#171;上一页</a><>
					<li id="productTypeNextPageLi"><a id="productTypeNextPage"
						href="javascript:">下一页&#187;</a><>
					<li class="disabled controls"><a>当前&nbsp; <span
							id="productTypePageNo"></span> / <span id="productTypePageSize"></span>
							条，共 <span id="productTypeCount"></span> 条
					</a><>
				</ul>
			</div>
		</div>
	</div>
</body>
</html>